#include "expression_evaluator.h"
#include <iostream>
#include <string>

using namespace std;

int main() {
		string init_exp;
 		cout << "biaodashi:";
		cin >> init_exp;
        cin.clear();
		cin.sync();
		while (!opt.empty()) {
			opt.pop();
		}
		while (!val.empty()) {
			val.pop();
		}
		if(!del_space(init_exp)){
			cout << "ILLEGAL" << endl;
			return 1;
		}
		if(!check(init_exp)){
			cout << "ILLEGAL" << endl;
			return 1;
		}
		string cng_exp;
		cng_exp.clear();
		if(!change(init_exp, cng_exp)){
			cout << "ILLEGAL" << endl;
			return 1;
		}
		if(!compute(cng_exp)){
			cout << "ILLEGAL" << endl;
			return 1;
		}
		double stdans = val.top();
		cout << (double)stdans << endl;
    return 0;
}